package edu.sctu.practice.class02.shilaihong.text.text11;

/**
 * Created by admin on 2015/10/15.
 */
public class MyTime {
    private int hour;
    private int minute;
    private int second;

    public MyTime(int hour, int minute, int second) {
        this.hour = hour;
        this.minute = minute;
        this.second = second;
    }

    public void addhour(int hou) {
        hour = hour + hou;
    }

    public void addminute(int min) {
        minute = minute + min;
    }

    public void addsecond(int sec) {
        second = second + sec;
    }

    public void subhour(int hou) {
        hour = hour - hou;
    }

    public void subminute(int min) {
        minute = minute - min;
    }

    public void subsecond(int sec) {
        second = second - sec;
    }

    public void display() {
        System.out.println("时间为：" + hour + "时" + minute + "分" + second + "秒");
    }

    public void check() {
        if (hour <= 24 & minute <= 60 & second <= 60) {
            System.out.println("这个时间是合理的！");
        } else {
            System.out.println("这个时间是不合理的！");
        }
    }
}
